$(function  () {
    $.post(
        ipurl+'/role/get',
        function(result) {
            if(result.code == 200){
                var menulist = result.data.results;
                var menuhtml = '<option value="0"></option>';
                for(var i=0;i<menulist.length;i++){
                    menuhtml+='<option value="'+menulist[i].ID+'">';
                    menuhtml+=menulist[i].name;
                    menuhtml+='</option>';
                }
                $("#type").html(menuhtml);
            }
        }
    );
    layui.use('form', function(){
        var form = layui.form();
        //监听提交
        form.on('submit(register)', function(data){
              var colleage = $("#colleage").val();
              var xnum = $("#xnum").val();
              var user = $("#name").val();
              var pwd = $("#pwd").val();
              var type = $("#type").val();
              $.ajax({
                url: ipurl+'/user/registered',
                data: {
                    col:colleage,
                    xn:xnum,
                    user: user,
                    pwd: pwd,
                    type: type
                },
                type: "POST",
                //dataType: "json",
                success:function(results){
                    console.log(results);
                },
                complete: function(data) {
                }
            });
            parent.location.reload(); 
            x_admin_close();
        });
    });

})


